home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 11
/
FM Towns Free Software Collection 11.iso
/
t_os
/
game
/
cometf
/
cometf.bas
next >
Wrap
BASIC Source File
|
1995-07-25
|
7KB
|
314 lines
10 ' コメットコントロール
20 '
30 '1995.7.25
40 '
50 DEFINT A-Z
60 DEFDBL C,V
70 '
80 CLEAR ,,,,,500000
90 SCREEN 1,0:SCREEN@ 0:CLS:DEF PEN 0,7
100 SCREEN 1,1:SCREEN@ 0:CLS:DEF PEN 0,7:GOSUB *COL.SET
110 RANDOMIZE TIME
120 '
130 GOSUB *CONST.SET
140 GOSUB *DIM.DECLARE
150 GOSUB *VAR.SET
160 GOSUB *MOUSE.INIT
170 GOSUB *HAIKEI.PREP
180 SCREEN 1,0,3,0
190 DEF PEN 0,5
200 PROG_END=FALSE
210 WHILE PROG_END=FALSE
220 GOSUB *INIT.COMET
230 GOSUB *INIT.STAR
240 GOSUB *SELECT
250 IF PROG_END=FALSE THEN
260 GOSUB *PRE.GAME
270 GAME_END=FALSE
280 WHILE GAME_END=FALSE
290 GOSUB *VECTOR.COMET
300 GOSUB *MOVE.COMET
310 SKIP=FALSE
320 GOSUB *ERASE.STAR
330 IF SKIP=FALSE THEN GOSUB *DISP.TIME
340 IF SKIP=FALSE THEN GOSUB *BLINK.STAR
350 IF SKIP=FALSE THEN WAIT 3
360 WEND
370 GOSUB *POST.GAME
380 ENDIF
390 WEND
400 WAIT 50
410 END
420 '
430 '
440 *CONST.SET
450 TRUE=-1:FALSE=0
460 MSX1=215:MSY1=160:MSX2=424:MSY2=319
470 RETURN
480 '
490 *DIM.DECLARE
500 N=15:X=33:Y=25
510 DIM CX(N),CY(N)
520 DIM STAR(X,Y)
530 RETURN
540 '
550 *VAR.SET
560 FOR X=0 TO 33
570 FOR Y=0 TO 25
580 IF X<3 OR 30<X OR Y<3 OR 22<Y THEN STAR(X,Y)=1
590 IF 10<X AND X<23 AND 7<Y AND Y<18 THEN STAR(X,Y)=1
600 NEXT
610 NEXT
620 RETURN
630 '
640 '
650 *SELECT
660 GOSUB *BEEP.SND
670 MOUSE 1,320,240,1
680 GOSUB *MSBT
690 IF BT=2 THEN PROG_END=TRUE
700 GOSUB *BEEP.SND
710 RETURN
720 '
730 '
740 *INIT.COMET
750 HP=15:SP=14:TP=1
760 FOR N=HP TO TP STEP -1
770 CX(N)=320:CY(N)=160
780 NEXT
790 GOSUB *COMET.PAL.SET
800 VX=-2:VY=0
810 PSET (CX(HP),CY(HP)),%HP
820 RETURN
830 '
840 *INIT.STAR
850 SCREEN 1,1
860 HS1=1:HS2=5:HS3=9:TIMER=0
870 STYPE=1:GOSUB *STAR.PAL.SET
880 STYPE=2:GOSUB *STAR.PAL.SET
890 STYPE=3:GOSUB *STAR.PAL.SET
900 DEF FONT "システム 12ドット"
910 SCNT=0
920 WHILE SCNT<70
930 X=INT(RND(1)*34):Y=INT(RND(1)*26)
940 IF STAR(X,Y)=FALSE THEN
950 STAR(X,Y)=TRUE:SCNT=SCNT+1
960 C=INT(RND(1)*12)+1
970 SYMBOL ((X-1)*20+4,(Y-1)*20+4),"★",.75!,.75!,%C
980 ENDIF
990 WEND
1000 SCREEN 1,0
1010 RETURN
1020 '
1030 '
1040 *PRE.GAME
1050 TIME$="00:00:00"
1060 TM=-1
1070 GOSUB *DISP.TIME
1080 RETURN
1090 '
1100 *POST.GAME
1110 GOSUB *BEEP.SND
1120 GOSUB *MSBT
1130 SCREEN 1,1
1140 GOSUB *HAIKEI.PREP
1150 SCREEN 1,0
1160 LINE (0,0)-(639,479),PSET,%0,BF,%0
1170 RETURN
1180 '
1190 '
1200 *VECTOR.COMET
1210 WT=2
1220 IF MOUSE(2,0)=TRUE THEN WT=4
1230 IF MOUSE(2,1)=TRUE THEN WT=1
1240 SX=MOUSE(0):SY=MOUSE(1)
1250 DX=SX-CX:DY=SY-CY
1260 R!=SQR(DX*DX+DY*DY)+30
1270 VDX=DX/(R!*R!*R!)*4000*WT:VDY=DY/(R!*R!*R!)*4000*WT
1280 VX=VX+VDX:VY=VY+VDY
1290 RETURN
1300 '
1310 *MOVE.COMET
1320 CCX=CX(HP):CCY=CY(HP)
1330 LX=CX(TP) :LY=CY(TP)
1340 CX=CCX+VX:CY=CCY+VY
1350 GOSUB *XBOUND
1360 GOSUB *YBOUND
1370 SP=HP
1380 HP=HP+1:IF HP=16 THEN HP=1
1390 TP=HP+1:IF TP=16 THEN TP=1
1400 CX(HP)=CX:CY(HP)=CY
1410 GOSUB *COMET.PAL.SET
1420 LINE (CX(TP),CY(TP))-(LX,LY),PSET,%0
1430 LINE (CX,CY)-(CCX,CCY),PSET,%HP
1440 RETURN
1450 '
1460 *BLINK.STAR
1470 TIMER=TIMER+1
1480 IF TIMER=8 THEN
1490 TIMER=0
1500 STYPE=STYPE+1:IF STYPE=4 THEN STYPE=1
1510 SCREEN 1,1
1520 GOSUB *STAR.PAL.SET
1530 SKIP=TRUE
1540 SCREEN 1,0
1550 ENDIF
1560 RETURN
1570 '
1580 *XBOUND
1590 BOUND=FALSE
1600 IF CX<2 OR 637<CX THEN
1610 IF CX<2 THEN BX=2 ELSE BX=637
1620 BY=CCY+(CY-CCY)*(BX-CCX)/(CX-CCX)
1630 IF 2<=BY AND BY<=477 THEN
1640 CX=BX:CY=BY:VX=-VX/3:VY=VY/3:BOUND=TRUE
1650 ENDIF
1660 ENDIF
1670 RETURN
1680 '
1690 *YBOUND
1700 IF BOUND=FALSE THEN
1710 IF CY<2 OR 477<CY THEN
1720 IF CY<2 THEN BY=2 ELSE BY=477
1730 BX=CCX+(CX-CCX)*(BY-CCY)/(CY-CCY)
1740 CX=BX:CY=BY:VX=VX/3:VY=-VY/3
1750 ENDIF
1760 ENDIF
1770 RETURN
1780 '
1790 *ERASE.STAR
1800 SSX=CX\20+1:SSY=CY\20+1
1810 SX=SSX:SY=SSY:GOSUB *ERASE.STAR.SUB
1820 IF SCNT<=15 THEN
1830 IF SKIP=FALSE THEN SX=SSX-1:SY=SSY :GOSUB *ERASE.STAR.SUB
1840 IF SKIP=FALSE THEN SX=SSX :SY=SSY-1:GOSUB *ERASE.STAR.SUB
1850 IF SKIP=FALSE THEN SX=SSX+1:SY=SSY :GOSUB *ERASE.STAR.SUB
1860 IF SKIP=FALSE THEN SX=SSX :SY=SSY+1:GOSUB *ERASE.STAR.SUB
1870 ENDIF
1880 RETURN
1890 '
1900 *ERASE.STAR.SUB
1910 IF STAR(SX,SY)=TRUE THEN
1920 SCREEN 1,1
1930 STAR(SX,SY)=FALSE
1940 LINE ((SX-1)*20,(SY-1)*20)-STEP(19,19),PSET,%14,BF,%14
1950 SCNT=SCNT-1:IF SCNT=0 THEN GAME_END=TRUE
1960 SKIP=TRUE
1970 SCREEN 1,0
1980 ENDIF
1990 RETURN
2000 '
2010 *DISP.TIME
2020 IF TIME>TM THEN
2030 SCREEN 1,1
2040 LINE (592,464)-STEP(639,479),PSET,%14,BF,%14
2050 TM=TIME
2060 T$=AKCNV$(RIGHT$(" "+STR$(TM),3))
2070 DEF FONT "システム 16ドット"
2080 SYMBOL (592,464),T$,1,1,%0
2090 SKIP=TRUE
2100 SCREEN 1,0
2110 ENDIF
2120 RETURN
2130 '
2140 '
2150 *COMET.PAL.SET
2160 G=&HF0:R=&HF0:B=&HF0
2170 FOR N=HP TO HP-14 STEP -1
2180 IF N<1 THEN NN=N+15 ELSE NN=N
2190 PALETTE NN,[G,R,B]
2200 G=G-&H10
2210 R=R-&H10
2220 B=B-&H10:IF B<&H40 THEN B=&H40
2230 NEXT
2240 RETURN
2250 '
2260 *STAR.PAL.SET
2270 ON STYPE GOSUB *SPS.1,*SPS.2,*SPS.3
2280 RETURN
2290 '
2300 *SPS.1
2310 HS1=HS1+1:IF HS1=5 THEN HS1=1
2320 P=HS1
2330 PALETTE P,[&H00,&HF0,&H00]
2340 P=P+1:IF P=5 THEN P=1
2350 PALETTE P,[&H00,&HB0,&H00]
2360 P=P+1:IF P=5 THEN P=1
2370 PALETTE P,[&H00,&H70,&H00]
2380 P=P+1:IF P=5 THEN P=1
2390 PALETTE P,[&H00,&HB0,&H00]
2400 RETURN
2410 '
2420 *SPS.2
2430 HS2=HS2+1:IF HS2=9 THEN HS2=5
2440 P=HS2
2450 PALETTE P,[&HF0,&HF0,&H00]
2460 P=P+1:IF P=9 THEN P=5
2470 PALETTE P,[&HB0,&HB0,&H00]
2480 P=P+1:IF P=9 THEN P=5
2490 PALETTE P,[&H70,&H70,&H00]
2500 P=P+1:IF P=9 THEN P=5
2510 PALETTE P,[&HB0,&HB0,&H00]
2520 RETURN
2530 '
2540 *SPS.3
2550 HS3=HS3+1:IF HS3=13 THEN HS3=9
2560 P=HS3
2570 PALETTE P,[&H90,&H90,&HF0]
2580 P=P+1:IF P=13 THEN P=9
2590 PALETTE P,[&H70,&H70,&HB0]
2600 P=P+1:IF P=13 THEN P=9
2610 PALETTE P,[&H50,&H50,&H70]
2620 P=P+1:IF P=13 THEN P=9
2630 PALETTE P,[&H70,&H70,&HB0]
2640 RETURN
2650 '
2660 '
2670 *HAIKEI.PREP
2680 LINE (0,0)-(639,479),PSET,%14,BF,%14
2690 LINE (MSX1-7,MSY1-7)-(MSX2+7,MSY2+7),PSET,%13,BF,%13
2700 DEF FONT "毛筆体 48ドット"
2710 SYMBOL (271,216),"彗星",3,3,%0
2720 RETURN
2730 '
2740 '
2750 *MOUSE.INIT
2760 DEF PEN 0,1
2770 MOUSE 0,1
2780 DIM PAND(64),PDOT(256)
2790 CIRCLE (10,10),7,%15
2800 GET@ (0,0)-(31,31),PAND,0
2810 GET@A (0,0)-(31,31),PDOT
2820 MOUSE 6,1,PAND,PDOT,10,10
2830 CLS
2840 MOUSE 4,MSX1,MSY1,MSX2,MSY2
2850 MOUSE 3,0,4
2860 MOUSE 3,1,4
2870 DEF PEN 0,5
2880 RETURN
2890 '
2900 '
2910 *MSBT
2920 CL=0
2930 WHILE CL=0
2940 IF MOUSE(2,0)=TRUE THEN CL=1
2950 IF MOUSE(2,1)=TRUE THEN CL=2
2960 WEND
2970 BT=CL
2980 WHILE CL>0
2990 IF MOUSE(2,0)=FALSE AND MOUSE(2,1)=FALSE THEN CL=0
3000 WEND
3010 RETURN
3020 '
3030 *BEEP.SND
3040 PLAY "V12@14O5C8"
3050 RETURN
3060 '
3070 '
3080 *COL.SET
3090 PALETTE 0,[&HF0,&HF0,&HF0]
3100 PALETTE 13,[&H00,&H00,&H40]
3110 PALETTE 14,[&H00,&H00,&H30]
3120 PALETTE 15,[&H00,&HF0,&H00]
3130 RETURN